home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3 / librw / RWTPtrHashSet.z / RWTPtrHashSet
Encoding:
Text File  |  2002-10-03  |  10.3 KB  |  265 lines

  1.  
  2.  
  3.  
  4. RRRRWWWWTTTTPPPPttttrrrrHHHHaaaasssshhhhSSSSeeeetttt((((3333CCCC++++++++))))                                        RRRRWWWWTTTTPPPPttttrrrrHHHHaaaasssshhhhSSSSeeeetttt((((3333CCCC++++++++))))
  5.  
  6.  
  7.  
  8. NNNNaaaammmmeeee
  9.      RWTPtrHashSet<T> - Rogue Wave library class
  10.  
  11. SSSSyyyynnnnooooppppssssiiiissss
  12.               #include <rw/tphset.h>
  13.  
  14.  
  15.  
  16.               unsigned hashFun(const T&);
  17.  
  18. PPPPlllleeeeaaaasssseeee NNNNooootttteeee!!!!
  19.      RWTPtrHashSet(hashFun) set;
  20.  
  21.  
  22.      IIIIffff yyyyoooouuuu ddddoooo nnnnooootttt hhhhaaaavvvveeee tttthhhheeee SSSSttttaaaannnnddddaaaarrrrdddd CCCC++++++++ LLLLiiiibbbbrrrraaaarrrryyyy,,,, uuuusssseeee tttthhhheeee iiiinnnntttteeeerrrrffffaaaacccceeee ddddeeeessssccccrrrriiiibbbbeeeedddd
  23.      hhhheeeerrrreeee....  OOOOtttthhhheeeerrrrwwwwiiiisssseeee,,,, uuuusssseeee tttthhhheeee iiiinnnntttteeeerrrrffffaaaacccceeee ttttoooo RRRRWWWWTTTTPPPPttttrrrrHHHHaaaasssshhhhSSSSeeeetttt described in the
  24.      Class Reference.
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31. DDDDeeeessssccccrrrriiiippppttttiiiioooonnnn
  32.      RRRRWWWWTTTTPPPPttttrrrrHHHHaaaasssshhhhSSSSeeeetttt<<<<TTTT>>>> is a derived class of RRRRWWWWTTTTPPPPttttrrrrHHHHaaaasssshhhhTTTTaaaabbbblllleeee<<<<TTTT>>>> where the
  33.      iiiinnnnsssseeeerrrrtttt(((()))) function has been overridden to accept only one item of a given
  34.      value.  Hence, each item in the collection will have a unique value.  As
  35.      with class RRRRWWWWTTTTPPPPttttrrrrHHHHaaaasssshhhhTTTTaaaabbbblllleeee<<<<TTTT>>>>,,,, you must supply a hashing function to the
  36.      constructor. The class TTTT must have:
  37.           well-defined equality semantics (TTTT::::::::ooooppppeeeerrrraaaattttoooorrrr========((((ccccoooonnnnsssstttt TTTT&&&&))))).
  38.  
  39.  
  40. PPPPeeeerrrrssssiiiisssstttteeeennnncccceeee
  41.      None
  42.  
  43. EEEExxxxaaaammmmpppplllleeee
  44.      This examples exercises a set of RRRRWWWWCCCCSSSSttttrrrriiiinnnnggggssss.
  45.  
  46.               #include <rw/tphset.h>
  47.           #include <rw/cstring.h>
  48.           #include <rw/rstream.h>
  49.           main()  {
  50.             RWTPtrHashSet<RWCString> set(RWCString::hash);
  51.             set.insert(new RWCString("one"));
  52.             set.insert(new RWCString("two"));
  53.             set.insert(new RWCString("three"));
  54.             set.insert(new RWCString("one"));
  55.             cout << set.entries() << endl;  // Prints "3"
  56.             set.clearAndDestroy();
  57.             return 0;
  58.           }
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. RRRRWWWWTTTTPPPPttttrrrrHHHHaaaasssshhhhSSSSeeeetttt((((3333CCCC++++++++))))                                        RRRRWWWWTTTTPPPPttttrrrrHHHHaaaasssshhhhSSSSeeeetttt((((3333CCCC++++++++))))
  71.  
  72.  
  73.  
  74.      Program output:
  75.  
  76.               3
  77.  
  78.  
  79.  
  80.  
  81. PPPPuuuubbbblllliiiicccc CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrr
  82.               RRRRWWWWTTTTPPPPttttrrrrHHHHaaaasssshhhhSSSSeeeetttt<T>(unsigned (*hashFun)(const T&),
  83.                            size_t buckets = RWDEFAULT_CAPACITY);
  84.  
  85.  
  86.      Constructs an empty hashing set.  The first argument is a pointer to a
  87.      user-defined hashing function for items of type TTTT.... The table will
  88.      initally have bbbbuuuucccckkkkeeeettttssss buckets although this can be changed with member
  89.      function rrrreeeessssiiiizzzzeeee(((()))).
  90.  
  91. PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr FFFFuuuunnnnccccttttiiiioooonnnnssss
  92.               RWTPtrHashSet<T>&
  93.           UUUUnnnniiiioooonnnn((((const RWTPtrHashSet<T>& h);
  94.  
  95.  
  96.      Computes the union of self and hhhh, modifying self and returning self.
  97.  
  98.               RWTPtrHashSet<T>&
  99.           ddddiiiiffffffffeeeerrrreeeennnncccceeee((((const RWTPtrHashSet<T>& h);
  100.  
  101.  
  102.      Computes the disjunction of self and hhhh, modifying self and returning
  103.      self.
  104.  
  105.               RWTPtrHashSet<T>&
  106.           iiiinnnntttteeeerrrrsssseeeeccccttttiiiioooonnnn((((const RWTPtrHashSet<T>& h);
  107.  
  108.  
  109.      Computes the intersection of self and hhhh, modifying self and returning
  110.      self.
  111.  
  112.               RWTPtrHashSet<T>&
  113.           ssssyyyymmmmmmmmeeeettttrrrriiiiccccDDDDiiiiffffffffeeeerrrreeeennnncccceeee((((const RWTPtrHashSet<T>& h);
  114.  
  115.  
  116.      Computes the symmetric difference between self and hhhh, modifying self and
  117.      returning self.
  118.  
  119.               RWBoolean
  120.           iiiissssSSSSuuuubbbbsssseeeettttOOOOffff((((const RWTPtrHashSet<T>& h) const;
  121.  
  122.  
  123.      Returns TTTTRRRRUUUUEEEE if self is a subset of hhhh.
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. RRRRWWWWTTTTPPPPttttrrrrHHHHaaaasssshhhhSSSSeeeetttt((((3333CCCC++++++++))))                                        RRRRWWWWTTTTPPPPttttrrrrHHHHaaaasssshhhhSSSSeeeetttt((((3333CCCC++++++++))))
  137.  
  138.  
  139.  
  140.               RWBoolean
  141.           iiiissssPPPPrrrrooooppppeeeerrrrSSSSuuuubbbbsssseeeettttOOOOffff((((const RWTPtrHashSet<T>& h) const;
  142.  
  143.  
  144.      Returns TTTTRRRRUUUUEEEE if self is a proper subset of hhhh.
  145.  
  146.               RWBoolean
  147.           iiiissssEEEEqqqquuuuiiiivvvvaaaalllleeeennnntttt((((const RWTPtrHashSet<T>& h) const;
  148.  
  149.  
  150.      Returns TTTTRRRRUUUUEEEE if self and hhhh are identical.
  151.  
  152.               RWBoolean
  153.           ooooppppeeeerrrraaaattttoooorrrr!!!!====(const RWTPtrHashSet<T>& h) const;
  154.  
  155.  
  156.      Returns FFFFAAAALLLLSSSSEEEE if self and hhhh are identical.
  157.  
  158.               void
  159.           aaaappppppppllllyyyy(void (*applyFun)(T*, void*), void* d);
  160.  
  161.  
  162.      Inherited from class RRRRWWWWTTTTPPPPttttrrrrHHHHaaaasssshhhhTTTTaaaabbbblllleeee<<<<TTTT>>>>.
  163.  
  164.               void
  165.           cccclllleeeeaaaarrrr();
  166.  
  167.  
  168.      Inherited from class RRRRWWWWTTTTPPPPttttrrrrHHHHaaaasssshhhhTTTTaaaabbbblllleeee<<<<TTTT>>>>.
  169.  
  170.               void
  171.           cccclllleeeeaaaarrrrAAAAnnnnddddDDDDeeeessssttttrrrrooooyyyy();
  172.  
  173.  
  174.      Inherited from class RRRRWWWWTTTTPPPPttttrrrrHHHHaaaasssshhhhTTTTaaaabbbblllleeee<<<<TTTT>>>>.
  175.  
  176.               RWBoolean
  177.           ccccoooonnnnttttaaaaiiiinnnnssss(const T* a) const;
  178.  
  179.  
  180.      Inherited from class RRRRWWWWTTTTPPPPttttrrrrHHHHaaaasssshhhhTTTTaaaabbbblllleeee<<<<TTTT>>>>.
  181.  
  182.               size_t
  183.           eeeennnnttttrrrriiiieeeessss() const;
  184.  
  185.  
  186.      Inherited from class RRRRWWWWTTTTPPPPttttrrrrHHHHaaaasssshhhhTTTTaaaabbbblllleeee<<<<TTTT>>>>.
  187.  
  188.               T*
  189.           ffffiiiinnnndddd(const T* target) const;
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. RRRRWWWWTTTTPPPPttttrrrrHHHHaaaasssshhhhSSSSeeeetttt((((3333CCCC++++++++))))                                        RRRRWWWWTTTTPPPPttttrrrrHHHHaaaasssshhhhSSSSeeeetttt((((3333CCCC++++++++))))
  203.  
  204.  
  205.  
  206.      Inherited from class RRRRWWWWTTTTPPPPttttrrrrHHHHaaaasssshhhhTTTTaaaabbbblllleeee<<<<TTTT>>>>.
  207.  
  208.               void
  209.           iiiinnnnsssseeeerrrrtttt(T* a);
  210.  
  211.  
  212.      Redefined from class RRRRWWWWTTTTPPPPttttrrrrHHHHaaaasssshhhhTTTTaaaabbbblllleeee<<<<TTTT>>>> to allow an object of a given
  213.      value to be inserted only once.
  214.  
  215.               RWBoolean
  216.           iiiissssEEEEmmmmppppttttyyyy() const;
  217.  
  218.  
  219.      Inherited from class RRRRWWWWTTTTPPPPttttrrrrHHHHaaaasssshhhhTTTTaaaabbbblllleeee<<<<TTTT>>>>.
  220.  
  221.               size_t
  222.           ooooccccccccuuuurrrrrrrreeeennnncccceeeessssOOOOffff(const T* a) const;
  223.  
  224.  
  225.      Inherited from class RRRRWWWWTTTTPPPPttttrrrrHHHHaaaasssshhhhTTTTaaaabbbblllleeee<<<<TTTT>>>>.
  226.  
  227.               T*
  228.           rrrreeeemmmmoooovvvveeee(const T* a);
  229.  
  230.  
  231.      Inherited from class RRRRWWWWTTTTPPPPttttrrrrHHHHaaaasssshhhhTTTTaaaabbbblllleeee<<<<TTTT>>>>.
  232.  
  233.               size_t
  234.           rrrreeeemmmmoooovvvveeeeAAAAllllllll(const T* a);
  235.  
  236.  
  237.      Inherited from class RRRRWWWWTTTTPPPPttttrrrrHHHHaaaasssshhhhTTTTaaaabbbblllleeee<<<<TTTT>>>>.
  238.  
  239.               void
  240.           rrrreeeessssiiiizzzzeeee(size_t N);
  241.  
  242.  
  243.      Inherited from class RRRRWWWWTTTTPPPPttttrrrrHHHHaaaasssshhhhTTTTaaaabbbblllleeee<<<<TTTT>>>>.
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.